25. Quiz: Techniques for Importing Modules

Importing and accessing from modules

In this quiz, you'll be using different methods to import and use the random.randint() function from the random module. Your task is to match the import statement with the way you would then call the function itself.

QUIZ QUESTION::

Match the import statement with the way that random.randint() is called.

ANSWER CHOICES:



Import statement

Calling the function

import random

from random import randint

import random as rd

from random import randint as rint

from random import *

SOLUTION:

Import statement

Calling the function

from random import *

from random import randint

import random as rd

import random

from random import randint as rint